/**
 * 数据统计页面样式
 * 提供现代化、响应式的界面设计
 */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 100vh;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.9;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 时间选择器样式 */
.time-selector {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.time-selector-group {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.time-selector label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.time-selector select,
.time-selector input {
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.time-selector select:focus,
.time-selector input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.apply-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
}

.apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 统计卡片样式 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 24px;
}

.stat-icon.success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.stat-icon.danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.stat-content h3 {
    font-size: 14px;
    color: #777;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    display: block;
    line-height: 1;
}

.stat-change {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 图表容器样式 */
.charts-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.chart-row {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr 1fr;
}

.chart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.chart-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.chart-container.full-width {
    grid-column: span 2;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e1e8ed;
    position: relative;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.chart-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chart-controls select {
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

.chart-controls select:focus {
    outline: none;
    border-color: #667eea;
}

.chart-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.chart-btn:hover {
    transform: translateY(-1px);
}

.chart-btn.export-table {
    background: #48bb78;
}

.chart-btn.export-table:hover {
    background: #38a169;
}

.chart-btn.download-chart:hover {
    background: #5a67d8;
}

.chart-content {
    padding: 25px;
    height: 350px;
    position: relative;
}

.chart-content canvas {
    max-height: 100%;
    border-radius: 16px;
}

/* 表格样式 */
.table-container {
    /* overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e1e8ed; */
    flex: 1 1 0;
    overflow-y: auto;
    max-height: 100%;
    min-height: 0;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed;
}

.detail-table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e1e8ed;
    font-size: 14px;
}

.detail-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f3f4;
    font-size: 14px;
    text-align: center;
}

.detail-table td:first-child {
    text-align: left;
}

.detail-table tr:hover {
    background: #f8f9fa;
}

.severity-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.high {
    background: #fee;
    color: #c53030;
}

.severity-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.severity-badge.low {
    background: #d4edda;
    color: #155724;
}

.trend-indicator {
    font-size: 12px;
    color: #999;
}

/* 效率指标样式 */
.efficiency-metrics {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    justify-content: center;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.metric-label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.metric-value {
    font-weight: 700;
    color: #333;
    font-size: 16px;
}

/* 系统状态样式 */
.system-status {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    justify-content: center;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.online {
    background: #2ecc71;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.3);
}

.status-indicator.warning {
    background: #f39c12;
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.3);
}

.status-indicator.offline {
    background: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

/* 数据摘要样式 */
.summary-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
}

.summary-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.summary-content {
    padding: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    background: #fff;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.07);
    min-height: 70px;
    word-break: keep-all;
    transition: all 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.1);
    border-left: 7px solid #667eea;
}

.summary-label {
    font-weight: 500;
    color: #667eea;
    font-size: 16px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    display: block;
    width: 100%;
    white-space: normal;
    word-break: keep-all;
}

.summary-item span:last-child {
    font-weight: 700;
    color: #333;
    font-size: 18px;
    letter-spacing: 0.5px;
    margin-top: 2px;
    width: 100%;
    word-break: keep-all;
    white-space: normal;
    text-align: left;
}

/* 响应式：小屏幕保持单列显示 */
@media (max-width: 768px) {
    .summary-content {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, auto);
        padding: 16px;
        gap: 12px;
    }

    .summary-item {
        padding: 14px 16px;
        min-height: auto;
    }

    .summary-item span:last-child {
        min-width: 80px;
        padding: 6px 12px;
    }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e8ed;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e1e8ed;
    background: #f8f9fa;
    text-align: right;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        padding: 15px;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

    .chart-container.full-width {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-left h1 {
        font-size: 1.5rem;
    }

    .time-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .time-selector-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .chart-content {
        height: 250px;
        padding: 15px;
    }

    .summary-content {
        grid-template-columns: 1fr;
    }

    .summary-item {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .efficiency-metrics,
    .system-status {
        gap: 15px;
    }

    .metric-item,
    .status-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        border-radius: 0;
    }

    .header {
        padding: 15px;
        margin-bottom: 20px;
    }

    .time-selector {
        padding: 15px;
    }

    .chart-content {
        height: 200px;
        padding: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
        background: white;
    }

    .header {
        background: #667eea;
        color: white;
    }

    .back-btn,
    .refresh-btn,
    .chart-btn {
        display: none;
    }

    .chart-content {
        height: auto;
        min-height: 300px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-container,
.stat-card {
    animation: fadeIn 0.6s ease-out forwards;
}

.chart-container:nth-child(1) {
    animation-delay: 0.1s;
}

.chart-container:nth-child(2) {
    animation-delay: 0.2s;
}

.chart-container:nth-child(3) {
    animation-delay: 0.3s;
}

.chart-container:nth-child(4) {
    animation-delay: 0.4s;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .stat-icon {
        border: 2px solid #000;
    }

    .chart-container {
        border: 1px solid #000;
    }

    .btn {
        border: 2px solid #000;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .spinner {
        animation: none;
    }
}

/* 全屏模态框基础样式 */
.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.fullscreen-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 图表类型选择器样式 */
.chart-type-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 0px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    position: absolute;
    top: 16px;
    right: 230px;
}

.chart-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 70px;
    gap: 6px;
}

.chart-type-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.chart-type-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chart-type-btn .icon {
    font-size: 20px;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

.chart-type-btn.active .icon {
    transform: scale(1.1);
}

.chart-type-btn .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.chart-type-btn.active .label {
    opacity: 1;
}